//
//  QGAdhocCell.m
//  车福内测
//
//  Created by heew on 15/12/7.
//  Copyright © 2015年 heew. All rights reserved.
//

#import "QGAdhocCell.h"
#import "QGAdHocListController.h" // 仅仅是为了导入app模型
#import "UIImageView+AFNetworking.h"

@interface QGAdhocCell ()
@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *appNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *appCreateLabel;

@end

@implementation QGAdhocCell
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *identifier = @"QGAdhoc";
    QGAdhocCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
    }
    return cell;
}

- (void)setApp:(QGAdHocApp *)app {
    _app = app;
    NSString *iconUrlString = [NSString stringWithFormat:@"http://7kttjt.com1.z0.glb.clouddn.com/image/view/app_icons/%@/120",app.appIcon];
    NSURL *url = [NSURL URLWithString:iconUrlString];
    [self.iconView setImageWithURL:url placeholderImage:[UIImage imageNamed:@"Icon-60"]];
    self.appNameLabel.text = [NSString stringWithFormat:@"%@%@",app.appName,app.appVersion];
    self.appCreateLabel.text = [NSString stringWithFormat:@"打包时间: %@",app.appCreated];
}

@end
